package errmsg

const (
	SUCCESS = 200
	ERROR = 500

	// 1000~1999 token错误
	TOKEN_GET_FAILED = 1000
	TOKEN_PARSE_FAILED = 1001

	// 2000~2999 用户错误
	USER_REGISTER_FAILED = 2000
	USER_USERNAME_USED = 2001
	USER_EMAIL_USED = 2002
	USER_REPWD_FAILED = 2003
	USER_NAME_OR_PWD_FAILED = 2004
	USER_NOT_FOUND = 2005
	USER_SELECT_FAILED = 2006
	USER_UPDATE_FAILED = 2007
	USER_DELETE_FAILED = 2008

	// 3000~3999 歌手错误
	SINGER_ADD_FAILED = 3000
	SINGER_SELECT_FAILED = 3001
	SINGER_UPDATE_FAILED = 3002
	SINGER_DELETE_FAILED = 3003

	// 4000~4999 歌曲错误
	SONG_ADD_FAILED = 4000
	SONG_SELECT_FAILED = 4001
	SONG_UPDATE_FAILED= 4002
	SONG_DELETE_FAILED = 4003

	// 5000~5999 歌单错误
	SONGLIST_ADD_FAILED = 5000
	SONGLIST_SELECT_FAILED = 5001
	SONGLIST_UPDATE_FAILED = 5002
	SONG_LIST_DELETE_FAILED = 5003
	SONGLIST_ADD_SONG_FAILED = 5004
	SONGLIST_DELETE_SONG_FAILED = 5005
	SONGLIST_DELETE_RELATE_FAILED = 5006
	SONGLIST_INSERT_RELATE_RELATE = 5007
)

var codemsg = map[int]string {
	SUCCESS: "OK",
	ERROR: "FAILED",

	TOKEN_GET_FAILED: "获取token失败",
	TOKEN_PARSE_FAILED: "解析token失败",

	USER_REGISTER_FAILED: "注册失败",
	USER_USERNAME_USED: "用户名已经被使用",
	USER_EMAIL_USED: "邮箱已经被使用",
	USER_REPWD_FAILED: "两次密码不一致",
	USER_NAME_OR_PWD_FAILED: "用户名或密码错误",
	USER_NOT_FOUND: "用户不存在",
	USER_SELECT_FAILED: "用户查询失败",
	USER_UPDATE_FAILED: "用户更新失败",
	USER_DELETE_FAILED: "用户删除失败",

	SINGER_ADD_FAILED: "添加歌手失败",
	SINGER_SELECT_FAILED: "查询歌手失败",
	SINGER_UPDATE_FAILED: "歌手信息更新失败",
	SINGER_DELETE_FAILED: "歌手删除失败",

	SONG_ADD_FAILED: "歌曲添加失败",
	SONG_SELECT_FAILED: "歌曲查找失败",
	SONG_UPDATE_FAILED: "歌曲更新失败",
	SONG_DELETE_FAILED: "歌曲删除失败",

	SONGLIST_ADD_FAILED: "歌单添加失败",
	SONGLIST_SELECT_FAILED: "歌单查询失败",
	SONGLIST_UPDATE_FAILED: "歌单更新失败",
	SONG_LIST_DELETE_FAILED: "歌单删除失败",
	SONGLIST_ADD_SONG_FAILED: "歌单的歌曲添加失败",
	SONGLIST_DELETE_SONG_FAILED: "删除歌单的歌曲失败",
	SONGLIST_DELETE_RELATE_FAILED: "删除歌单下个所有歌曲失败",
	SONGLIST_INSERT_RELATE_RELATE: "添加歌曲关系失败",
}

func GetErrMsg(code int) string {
	return codemsg[code]
}